

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>小说列表</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/layuiadmin/style/admin.css" media="all">
<!--  <link rel="stylesheet" href="/static/layuiadmin/style/template.css" media="all">-->

  <style>
    .brief {
      line-height: 1.5;
      color: #777;
      max-width: 90%;
      height: 30px;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      padding-top: 1px !important;
    }

    .text-c{
      text-align: center !important;
    }

    .layui-card span[lay-separator] {
      margin: 0 10px;
      color: #999;
      font-weight: bold;
    }

    #LAY-component-grid-stack .page {
      display: flex;
      justify-content: center;
      flex-direction: column;
      text-align: center;
      height: 120px;
    }

    .caller-item {
      padding: 6px 0px;
      overflow: hidden;
    }

    table em {
      font-style: normal;
      margin-left: 5px;
    }

    .caller-main p {
      padding: 9px 0;
    }
    .caller-fl{
      float: left;
      position: absolute;
      left: 110px;
      top: 6px;
    }
    .layui-layer-demo .layui-layer-title {
      border: none;
      background-color: #333;
      color: #fff;
    }
  </style>
</head>

<body>
<div class="layui-fluid" id="LAY-component-grid-stack">

    <div class="layui-row layui-col-space5">
      <div class="layui-col-md12" style="min-width: 880px;">
        <div class="layui-card">
          <div class="layui-card-header">
            条件检索
          </div>
        <div class="layui-card-body" style="text-align: left;padding-top: 30px;">

          <form class="layui-form" action="" method="get">
            <input type="hidden" name="freq_id" value="{$freq.id}">
            <input type="hidden" name="class_id" value="{$class.id}">
            <input type="hidden" name="update_status" value="{$update_status}">
            <input type="hidden" name="words_type" value="{$words_type}">
            <input type="hidden" name="label_id" value="{$label_id}">
            <div class="layui-form-item">
              <label class="layui-form-label">频道：</label>
              <div class="layui-input-block">
                <div class="layui-btn-container">
                  <a type="button" href="/spread/novels?class_id={$class.id}&update_status={$update_status}&words_type={$words_type}&scale={$scale}&label_id={$label_id}" class="layui-btn layui-btn-sm {if !$freq}{else /}layui-btn-primary{/if}">不限</a>
                  {foreach $freqArr as $v}
                  <a type="button" href="/spread/novels?freq_id={$v.id}&class_id={$class.id}&update_status={$update_status}&words_type={$words_type}&scale={$scale}&label_id={$label_id}" class="layui-btn layui-btn-sm {if $freq.id == $v.id}{else /}layui-btn-primary{/if}">{$v.name}</a>
                  {/foreach}
                </div>
              </div>
            </div>

            <div class="layui-form-item">
              <label class="layui-form-label">分类：</label>
              <div class="layui-input-block">
                <div class="layui-btn-container">
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&update_status={$update_status}&words_type={$words_type}&scale={$scale}&label_id={$label_id}" class="layui-btn layui-btn-sm {if !$class}{else /}layui-btn-primary{/if}">不限</a>
                  {foreach $classArr as $v}
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$v.id}&update_status={$update_status}&words_type={$words_type}&scale={$scale}&label_id={$label_id}" class="layui-btn layui-btn-sm {if $class.id == $v.id}{else /}layui-btn-primary{/if} ">{$v.name}</a>
                  {/foreach}
                </div>
              </div>
            </div>

            <div class="layui-form-item">
              <label class="layui-form-label">状态：</label>
              <div class="layui-input-block">
                <div class="layui-btn-container">
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&words_type={$words_type}&scale={$scale}&label_id={$label_id}" class="layui-btn layui-btn-sm {if $update_status === ''}{else /}layui-btn-primary{/if}">不限</a>
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status=0&words_type={$words_type}&scale={$scale}&label_id={$label_id}" class="layui-btn layui-btn-sm {if $update_status === 0}{else /}layui-btn-primary{/if}">连载</a>
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status=1&words_type={$words_type}&scale={$scale}&label_id={$label_id}" class="layui-btn layui-btn-sm {if $update_status === 1}{else /}layui-btn-primary{/if}">完结</a>
                </div>
              </div>
            </div>

            <div class="layui-form-item">
              <label class="layui-form-label">字数：</label>
              <div class="layui-input-block">
                <div class="layui-btn-container">
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status={$update_status}&words_type=0&scale={$scale}&label_id={$label_id}" class="layui-btn layui-btn-sm {if $words_type == 0}{else /}layui-btn-primary{/if}">不限</a>
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status={$update_status}&words_type=1&scale={$scale}&label_id={$label_id}" class="layui-btn layui-btn-sm {if $words_type == 1}{else /}layui-btn-primary{/if} ">30万字以下</a>
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status={$update_status}&words_type=2&scale={$scale}&label_id={$label_id}" class="layui-btn layui-btn-sm {if $words_type == 2}{else /}layui-btn-primary{/if} ">30-50万字</a>
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status={$update_status}&words_type=3&scale={$scale}&label_id={$label_id}" class="layui-btn layui-btn-sm {if $words_type == 3}{else /}layui-btn-primary{/if} ">50-100万字</a>
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status={$update_status}&words_type=4&scale={$scale}&label_id={$label_id}" class="layui-btn layui-btn-sm {if $words_type == 4}{else /}layui-btn-primary{/if} ">100-200万字</a>
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status={$update_status}&words_type=5&scale={$scale}&label_id={$label_id}" class="layui-btn layui-btn-sm {if $words_type == 5}{else /}layui-btn-primary{/if} ">200万字以上</a>
                </div>
              </div>
            </div>


            <div class="layui-form-item">
              <label class="layui-form-label">评级：</label>
              <div class="layui-input-block">
                <div class="layui-btn-container">
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status={$update_status}&words_type={$words_type}&label_id={$label_id}" class="layui-btn layui-btn-sm {if $scale === ''}{else /}layui-btn-primary{/if}">不限</a>
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status={$update_status}&words_type={$words_type}&scale=S&label_id={$label_id}" class="layui-btn layui-btn-sm {if $scale === 'S'}{else /}layui-btn-primary{/if}">S</a>
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status={$update_status}&words_type={$words_type}&scale=A&label_id={$label_id}" class="layui-btn layui-btn-sm {if $scale === 'A'}{else /}layui-btn-primary{/if}">A</a>
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status={$update_status}&words_type={$words_type}&scale=B&label_id={$label_id}" class="layui-btn layui-btn-sm {if $scale === 'B'}{else /}layui-btn-primary{/if}">B</a>
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status={$update_status}&words_type={$words_type}&scale=C&label_id={$label_id}" class="layui-btn layui-btn-sm {if $scale === 'C'}{else /}layui-btn-primary{/if}">C</a>
                </div>
              </div>
            </div>

            <div class="layui-form-item">
              <label class="layui-form-label">标签：</label>
              <div class="layui-input-block">
                <div class="layui-btn-container">
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status={$update_status}&words_type={$words_type}&scale={$scale}" class="layui-btn layui-btn-sm {if $label_id == 0}{else /}layui-btn-primary{/if}">不限</a>
                  {foreach $labels as $v}
                  <a type="button" href="/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status={$update_status}&words_type={$words_type}&scale={$scale}&label_id={$v.id}" class="layui-btn layui-btn-sm {if $label_id == $v.id}{else /}layui-btn-primary{/if}">{$v.name}</a>
                  {/foreach}
                </div>
              </div>
            </div>
            <div class="layui-form-item">
              <label class="layui-form-label">关键词：</label>
              <div class="layui-input-inline">
                <input type="text" name="keyword" placeholder="ID或书名" autocomplete="off" class="layui-input" value="{$keyword}">
              </div>
              <div class="layui-input-inline">
                <button class="layui-btn" type="submit">搜索</button>
              </div>
            </div>
          </form>
        </div>
      </div>
      </div>
      <div class="layui-col-md12" style="min-width: 880px;">
        <div class="layui-card">
          <div class="layui-card-body">
            <table class="layui-table" lay-even lay-skin="line">
              <colgroup>
                <col width="80">
                <col width="50%">
                <col width="150">
                <col width="150">
                <col width="150">
              </colgroup>
              <thead>
              <tr>
                <th class="text-c">小说ID</th>
                <th>小说信息</th>
                <th class="text-c" lay-tips="点击下方自定义价格" lay-offset="100">千字价格</th>
                <th class="text-c" lay-tips="点击下方自定义收费章节" lay-offset="100">收费章节</th>
                <th class="text-c">
                  是否已推<br>
                  已推链接数
                </th>
              </tr>
              </thead>
              <tbody>
              {foreach $list as $v}
              <tr>
                <td class="text-c">{$v.id}</td>
                <td>
                  <div class="caller-item">
                    <a  style="float: left;" lay-href="/spread/novelInfo.html?id={$v.id}" lay-text="{$v.title}">
                      <img class="cover" src="/static/imgs/pic.jpg" lay-src="{$v.cover_text}" width="72" height="96">
                    </a>
                    <div class="caller-main caller-fl">
                      <p><strong><a lay-href="/spread/novelInfo.html?id={$v.id}" lay-text="{$v.title}">{$v.title}</a></strong>
                        {if $v.update_status != 1}
                        <em style="color: #999999;" lay-tips="{$v.chapter_up_time}" >[更新中]</em>
                        {else /}
                        <em style="color: #999999;">[已完结]</em>
                        {/if}
                      </p>
                      <p class="caller-adds brief">{$v.brief|trim}</p>
                      <p style="font-weight:300;">{$v.freq['name']}<span lay-separator="">·</span>{$v.novel_class['name']}<span lay-separator="">·</span>{$v.number_words_text}</p>
                    </div>
                  </div>
                </td>
                <td class="text-c">
                  <a href="javascript:void(0);" style="color: #009688;" onclick="custom(1,'{$v.id}');">{$v.words_fee}书币</a>
                </td>
                <td class="text-c"><a href="javascript:void(0);" style="color: #009688;" onclick="custom(2,'{$v.id}');">{$v.first_pay}章</a></td>
                <td class="text-c">
                  {if $v.linkCount > 0}
                  <a href="#" style="color: #009688;">{$v.linkCount}</a>
                  {else /}
                  未推
                  {/if}
                </td>
              </tr>
              {/foreach}
              </tbody>
            </table>
            <div id="page" style="text-align: center;"></div>
          </div>
        </div>
      </div>
    </div>

</div>

<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
  var $;
  var admin;
  layui.config({
    base: '/static/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'laypage','flow'], function () {
    var laypage = layui.laypage;
    var flow = layui.flow;
    $ = layui.$;
    admin = layui.admin;

    //懒加载
    flow.lazyimg();

    laypage.render({
      elem: 'page'
      ,count: {$count}
      ,limit:{$limit}
      ,curr:{$page}
      ,layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
      ,jump: function(obj,first){
        console.log(obj)
        if(!first){
          window.location.href = '/spread/novels?freq_id={$freq.id}&class_id={$class.id}&update_status={$update_status}&words_type{$words_type}&label_id={$label_id}&keyword={$keyword}&page=' + obj.curr + '&limit=' + obj.limit;
        }
      }
    });
  });
  function custom(type,nid){
    {if $roleAlias != 'agent' && $roleAlias != 'channel'}
      layer.msg('当前角色无需自定义');
    {else /}
      if (type === 1){
        var title = '自定义千字书币';
      }else {
        var title = '自定义收费章节';
      }

      layer.open({
        type: 2,
        title:title,
        skin: 'layui-layer-demo', //样式类名
        closeBtn: 0, //不显示关闭按钮
        offset: '150px',
        area: ['520px', '300px'],
        anim: 2,
        content: '/spread/customNovelForm.html?novel_id=' + nid + '&type=' + type,
        shadeClose: true //开启遮罩关闭
        ,btn: ['确定', '取消']
        ,yes: function(index, layero){
          var iframeWindow = window['layui-layer-iframe'+ index]
                  ,submit = layero.find('iframe').contents().find("#LAY-user-role-submit");

          //监听提交
          iframeWindow.layui.form.on('submit(LAY-user-role-submit)', function (data) {
            var field = data.field; //获取提交的字段
            admin.req({
              url: '/spread/setCustom'
              , type: "POST"
              , data: field
              , done: function (res) {
                layer.msg('设置成功', {icon: 1, time: 1000}, function () {
                  layer.close(index); //关闭弹层
                  location.reload();
                });
              }, not_finish: function (res) {
                layer.msg(res.msg);
              }
            });
          });

          submit.trigger('click');
        }
        ,success: function(layero, index){
        }
      });
    {/if}
  }
</script>
</body>